<template>
  <div class="content">
    <div class="detail">
      <div class="head"><span>用户信息</span></div>
      <div class="info">
        <div class="pic">
           <el-image

    :src="info.userExportVo.imgSrc"
    :preview-src-list="[info.userExportVo.imgSrc]">
  </el-image>
        </div>
        <table>
          <tr>
            <td>姓名 :</td>
            <td>{{ info.userExportVo.userName}}</td>
            <td>上传文件数 :</td>
            <td >
              {{ info.fileCounts }}
            </td>
          </tr>
          <tr>
            <td>手机号码 :</td>
            <td>{{ info.userExportVo.userPhone }}</td>
            <td>最近登录地点 :</td>
            <td class="blue cp" @click="toaddress(info.userExportVo.userPhone)">{{ info.userExportVo.loginAddress }}</td>
          </tr>

          <tr>
            <td>状态 :</td>
            <td v-if="info.userExportVo.userState==='禁用'" class="delete">{{info.userExportVo.userState}}</td>
            <td v-else class="green">{{info.userExportVo.userState}}</td>
            <td>用户建议 :</td>
            <td  class="blue cp" @click="toproposal(info.userExportVo.userPhone)">
              <div class="proposal">
                {{info.adviseContent}}
              </div>
            </td>
          </tr>
          <tr>
            <td>邀请码 :</td>
            <td>{{ info.userExportVo.userInvitationCode }}</td>
          </tr>
          <tr>
            <td>被邀请人 :</td>
            <td>{{info.userExportVo.userPersion}}</td>
          </tr>
          <tr>
            <td>最近登录时间 :</td>
            <td>{{ info.userExportVo.loginTime?setLocalTime( info.userExportVo.loginTime):info.userExportVo.loginTime }}</td>
          </tr>
          <tr>
            <td>注册时间 :</td>
            <td>{{ info.userExportVo.userRegisterTime ?setLocalTime(info.userExportVo.userRegisterTime):info.userExportVo.userRegisterTime  }}</td>
          </tr>
          <tr>
            <td>累计开会时长 :</td>
            <td>{{ info.sumConferenceTime }}</td>
          </tr>
          <tr>
            <td>创建会议数 :</td>
            <td>{{ info.conferenceCounts }}</td>
          </tr>
          <tr>
            <td>参会数 :</td>
            <td>{{ info.ParticipantCounts }}</td>
          </tr>
          <tr>
            <td>好友数 :</td>
            <td>{{ info.friendCount }}</td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {

    }
  },
  created () {
    const phone = sessionStorage.getItem('id')
    // this.$stroe.dispatch('userManage/getDetailData', phone)
    this.$store.dispatch('userManage/getDetailData', phone).then(res => {
      // console.log(res)
    }).catch(err => {
      this.$message({
        type: 'error',
        message: err,
        duration: 1000
      })
    })
  },
  computed: {
    info () {
      // return this.$store.state.userManage.tableData.filter(item => item.id === this.id)[0]
      return this.$store.state.userManage.tableData
    },
    id () {
      return Number(sessionStorage.getItem('id'))
    }
  },
  methods: {
    toaddress (id) {
      sessionStorage.setItem('id', id)

      this.$router.push({
        path: '/userManage/main/detail/address'
      })
    },
    setLocalTime (time) {
      return this.$moment(+new Date(time)).format('YYYY-MM-DD HH:mm:ss')
    },
    toproposal (id) {
      sessionStorage.setItem('id', id)

      this.$router.push({
        path: '/userManage/main/detail/proposal'
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.content {
  .detail {
    min-height: 932px;
    box-sizing: border-box;
    background: #ffffff;
    border-radius: 8px;
    // margin-top: 26px;
    padding: 0 24px;
    position: relative;
  }
  .pic {
    width: 120px;
    height: 120px;
    border: 1px solid #ccc;
    position: absolute;
    top: 127px;
    left: 44px;
    .el-image{
      width: 100%;
      height: 100%;
    }
  }
  .head {
    width: 100%;
    height: 78px;
    border-bottom: 1px solid #e6e9f0;
    position: relative;
    font-size: 16px;
    font-weight: 500;
    color: #1b1f35;
    span {
      position: absolute;
      bottom: 20px;
    }
  }
  .info {
    margin-top: 53px;
    margin-left: 200px;

    tr {
      color: #3d4966;
      vertical-align: top;
      td:nth-child(1) {
        width: 120px;
        height: 50px;
        color: #1b1f35;
        text-align: right;
      }
      td:nth-child(2) {
        padding-left: 20px;
        width: 240px;
      }
      td:nth-child(3) {
        width: 110px;
        text-align: right;
      }
      td:nth-child(4) {
        padding-left: 20px;
        height: 50px;
        overflow: hidden;
      }
    }
    .proposal {
      width: 200px;
      height: 44px;
      line-height: 22px;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      overflow: hidden;
      //   text-overflow: ellipsis !important;
    }
  }
}
</style>
